package com.inspur.security.cbb3.kms.keymanager.keyorders.service;

import com.inspur.security.cbb3.kms.keymanager.keyorders.po.KeyOrdersBean;
import com.inspur.security.cbb3.kms.keymanager.keyorders.vo.KeyOrdersAddVO;
import com.inspur.security.cbb3.kms.utils.PageRequestDate;
import javassist.NotFoundException;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.MissingServletRequestParameterException;


/**
 * 密钥定的service
 *
 * @author lijunchang
 */
public interface KeyOrdersService {

    /**
     * 进行密钥订单新增
     * 0.参数校验
     * 1.插入到密钥订单表
     * 2.rabbitmq调用密钥生成方法
     *
     * @param keyOrdersAddVO 密钥订单类
     * @return 新增结果
     */
    KeyOrdersBean generateKeyOrder(KeyOrdersAddVO keyOrdersAddVO);

    /**
     * MQ根据密钥订单uuid进行密钥生成
     * 0.查询密钥订单及其状态
     * 1.根据订单类型进行密钥操作/容器操作
     * 2.根据操作结果进行订单更新
     *
     * @param uuid 数据id
     */
    void mqGenerateKeyOrder(String uuid);

    /**
     * 删除密钥订单
     *
     * @param uuid 数据id
     * @return 操作结果
     * @throws MissingServletRequestParameterException  缺少参数异常
     * @throws NotFoundException                        未找到
     */
    KeyOrdersBean deleteKeyOrder(String uuid) throws MissingServletRequestParameterException, NotFoundException;

    /**
     * 进行密钥订单的更新
     * @param keyOrdersBean 密钥订单信息
     * @return  修改后信息
     */
    KeyOrdersBean update(KeyOrdersBean keyOrdersBean);

    /**
     * 根据id查询
     *
     * @param uuid 数据id
     * @return 查询结果
     * @throws MissingServletRequestParameterException  缺少参数异常
     * @throws NotFoundException                        未找到
     */
    KeyOrdersBean searchKeyOrder(String uuid) throws MissingServletRequestParameterException, NotFoundException;

    /**
     * 分页查询
     *
     * @param pageRequestDate 分页数据
     * @param searchParams    查询条件
     * @return 查询结果集
     */
    Page<KeyOrdersBean> searchKeyOrders(PageRequestDate pageRequestDate, KeyOrdersBean searchParams) ;

}
